package org.mspring.mlog.service.impl;

import org.mspring.mlog.entity.SpaceInfo;
import org.mspring.mlog.service.SpaceInfoService;
import org.mspring.platform.dao.hibernate.GenericDao;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * 
 * @author Gao Youbo
 * @since 2013年7月16日
 */
@Service
@Transactional
public class SpaceInfoServiceImpl extends GenericDao<SpaceInfo, Long> implements SpaceInfoService {

    @Override
    public SpaceInfo getByUser(Long user) {
        // TODO Auto-generated method stub
        return (SpaceInfo) getSession().createQuery("select info from SpaceInfo info where info.user = ?").setLong(0, user).setCacheable(true).setCacheRegion(SpaceInfo.class.getName()).uniqueResult();
    }

}
